/**
 * @file zuoOLED.c
 * @author 左~~
 * @brief 双模OLED驱动代码,可同时驱动一个iic �? 一个SPI接口的OLED (OLED2)
 * @version 2.0
 * @date 2024-10-11
 * 
 * @copyright Copyright (c) 2024
 * 
 */
#include "stc.h"
#include "OLED.h"
/*引脚配置,该部分不含有引脚初始�?*/



// #define OLED_W_SCL(x) P37=x
// #define OLED_W_SDA(x) P36=x

void OLED_W_SCL(char dataa)
{
	P37=dataa;
}
void OLED_W_SDA(char dataa)
{
	P36=dataa;
}


// #define OLED2_CS_Clr() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_4,GPIO_PIN_RESET)
// #define OLED2_CS_Set() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_4,GPIO_PIN_SET)

// #define OLED2_RST_Clr() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_0,GPIO_PIN_RESET)
// #define OLED2_RST_Set() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_0,GPIO_PIN_SET)

// #define OLED2_DC_Clr() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_1,GPIO_PIN_RESET)
// #define OLED2_DC_Set() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_1,GPIO_PIN_SET)

// #define OLED2_SCLK_Clr() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_5,GPIO_PIN_RESET)
// #define OLED2_SCLK_Set() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_5,GPIO_PIN_SET)

// #define OLED2_SDIN_Clr() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_7,GPIO_PIN_RESET)
// #define OLED2_SDIN_Set() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_7,GPIO_PIN_SET)


#if SIZE != 16
	const unsigned char  F6x8[][6] =		
	{
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00,// sp
	0x00, 0x00, 0x00, 0x2f, 0x00, 0x00,// !
	0x00, 0x00, 0x07, 0x00, 0x07, 0x00,// "
	0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14,// #
	0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12,// $
	0x00, 0x62, 0x64, 0x08, 0x13, 0x23,// %
	0x00, 0x36, 0x49, 0x55, 0x22, 0x50,// &
	0x00, 0x00, 0x05, 0x03, 0x00, 0x00,// '
	0x00, 0x00, 0x1c, 0x22, 0x41, 0x00,// (
	0x00, 0x00, 0x41, 0x22, 0x1c, 0x00,// )
	0x00, 0x14, 0x08, 0x3E, 0x08, 0x14,// *
	0x00, 0x08, 0x08, 0x3E, 0x08, 0x08,// +
	0x00, 0x00, 0x00, 0xA0, 0x60, 0x00,// ,
	0x00, 0x08, 0x08, 0x08, 0x08, 0x08,// -
	0x00, 0x00, 0x60, 0x60, 0x00, 0x00,// .
	0x00, 0x20, 0x10, 0x08, 0x04, 0x02,// /
	0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E,// 0
	0x00, 0x00, 0x42, 0x7F, 0x40, 0x00,// 1
	0x00, 0x42, 0x61, 0x51, 0x49, 0x46,// 2
	0x00, 0x21, 0x41, 0x45, 0x4B, 0x31,// 3
	0x00, 0x18, 0x14, 0x12, 0x7F, 0x10,// 4
	0x00, 0x27, 0x45, 0x45, 0x45, 0x39,// 5
	0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30,// 6
	0x00, 0x01, 0x71, 0x09, 0x05, 0x03,// 7
	0x00, 0x36, 0x49, 0x49, 0x49, 0x36,// 8
	0x00, 0x06, 0x49, 0x49, 0x29, 0x1E,// 9
	0x00, 0x00, 0x36, 0x36, 0x00, 0x00,// :
	0x00, 0x00, 0x56, 0x36, 0x00, 0x00,// ;
	0x00, 0x08, 0x14, 0x22, 0x41, 0x00,// <
	0x00, 0x14, 0x14, 0x14, 0x14, 0x14,// =
	0x00, 0x00, 0x41, 0x22, 0x14, 0x08,// >
	0x00, 0x02, 0x01, 0x51, 0x09, 0x06,// ?
	0x00, 0x32, 0x49, 0x59, 0x51, 0x3E,// @
	0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C,// A
	0x00, 0x7F, 0x49, 0x49, 0x49, 0x36,// B
	0x00, 0x3E, 0x41, 0x41, 0x41, 0x22,// C
	0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C,// D
	0x00, 0x7F, 0x49, 0x49, 0x49, 0x41,// E
	0x00, 0x7F, 0x09, 0x09, 0x09, 0x01,// F
	0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A,// G
	0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F,// H
	0x00, 0x00, 0x41, 0x7F, 0x41, 0x00,// I
	0x00, 0x20, 0x40, 0x41, 0x3F, 0x01,// J
	0x00, 0x7F, 0x08, 0x14, 0x22, 0x41,// K
	0x00, 0x7F, 0x40, 0x40, 0x40, 0x40,// L
	0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F,// M
	0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F,// N
	0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E,// O
	0x00, 0x7F, 0x09, 0x09, 0x09, 0x06,// P
	0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E,// Q
	0x00, 0x7F, 0x09, 0x19, 0x29, 0x46,// R
	0x00, 0x46, 0x49, 0x49, 0x49, 0x31,// S
	0x00, 0x01, 0x01, 0x7F, 0x01, 0x01,// T
	0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F,// U
	0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F,// V
	0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F,// W
	0x00, 0x63, 0x14, 0x08, 0x14, 0x63,// X
	0x00, 0x07, 0x08, 0x70, 0x08, 0x07,// Y
	0x00, 0x61, 0x51, 0x49, 0x45, 0x43,// Z
	0x00, 0x00, 0x7F, 0x41, 0x41, 0x00,// [
	0x00, 0x55, 0x2A, 0x55, 0x2A, 0x55,// 55
	0x00, 0x00, 0x41, 0x41, 0x7F, 0x00,// ]
	0x00, 0x04, 0x02, 0x01, 0x02, 0x04,// ^
	0x00, 0x40, 0x40, 0x40, 0x40, 0x40,// _
	0x00, 0x00, 0x01, 0x02, 0x04, 0x00,// '
	0x00, 0x20, 0x54, 0x54, 0x54, 0x78,// a
	0x00, 0x7F, 0x48, 0x44, 0x44, 0x38,// b
	0x00, 0x38, 0x44, 0x44, 0x44, 0x20,// c
	0x00, 0x38, 0x44, 0x44, 0x48, 0x7F,// d
	0x00, 0x38, 0x54, 0x54, 0x54, 0x18,// e
	0x00, 0x08, 0x7E, 0x09, 0x01, 0x02,// f
	0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C,// g
	0x00, 0x7F, 0x08, 0x04, 0x04, 0x78,// h
	0x00, 0x00, 0x44, 0x7D, 0x40, 0x00,// i
	0x00, 0x40, 0x80, 0x84, 0x7D, 0x00,// j
	0x00, 0x7F, 0x10, 0x28, 0x44, 0x00,// k
	0x00, 0x00, 0x41, 0x7F, 0x40, 0x00,// l
	0x00, 0x7C, 0x04, 0x18, 0x04, 0x78,// m
	0x00, 0x7C, 0x08, 0x04, 0x04, 0x78,// n
	0x00, 0x38, 0x44, 0x44, 0x44, 0x38,// o
	0x00, 0xFC, 0x24, 0x24, 0x24, 0x18,// p
	0x00, 0x18, 0x24, 0x24, 0x18, 0xFC,// q
	0x00, 0x7C, 0x08, 0x04, 0x04, 0x08,// r
	0x00, 0x48, 0x54, 0x54, 0x54, 0x20,// s
	0x00, 0x04, 0x3F, 0x44, 0x40, 0x20,// t
	0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C,// u
	0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C,// v
	0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C,// w
	0x00, 0x44, 0x28, 0x10, 0x28, 0x44,// x
	0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C,// y
	0x00, 0x44, 0x64, 0x54, 0x4C, 0x44,// z
	0x14, 0x14, 0x14, 0x14, 0x14, 0x14,// horiz lines
	};
#endif
/*OLED字模库，�?8像素，高16像素*/
const uint8_t OLED_F8x16[][16]=
{
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//  0
	
	0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00,//! 1
	
	0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//" 2
	
	0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,
	0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,//# 3
	
	0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,
	0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00,//$ 4
	
	0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,
	0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00,//% 5
	
	0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,
	0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10,//& 6
	
	0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//' 7
	
	0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,
	0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,//( 8
	
	0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,
	0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,//) 9
	
	0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,
	0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,//* 10
	
	0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,
	0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00,//+ 11
	
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,//, 12
	
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,//- 13
	
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,//. 14
	
	0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,
	0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,/// 15
	
	0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,
	0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,//0 16
	
	0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,
	0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//1 17
	
	0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,
	0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,//2 18
	
	0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,
	0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,//3 19
	
	0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,
	0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,//4 20
	
	0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,
	0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,//5 21
	
	0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,
	0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,//6 22
	
	0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,
	0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,//7 23
	
	0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,
	0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,//8 24
	
	0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,
	0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,//9 25
	
	0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,
	0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,//: 26
	
	0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,
	0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,//; 27
	
	0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,
	0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,//< 28
	
	0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,
	0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,//= 29
	
	0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,
	0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,//> 30
	
	0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,
	0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00,//? 31
	
	0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,
	0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00,//@ 32
	
	0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,
	0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,//A 33
	
	0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,
	0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,//B 34
	
	0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,
	0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,//C 35
	
	0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,
	0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,//D 36
	
	0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,
	0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,//E 37
	
	0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,
	0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,//F 38
	
	0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,
	0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,//G 39
	
	0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,
	0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,//H 40
	
	0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,
	0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//I 41
	
	0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,
	0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,//J 42
	
	0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,
	0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,//K 43
	
	0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,
	0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,//L 44
	
	0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,
	0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00,//M 45
	
	0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,
	0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,//N 46
	
	0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,
	0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,//O 47
	
	0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,
	0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,//P 48
	
	0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,
	0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,//Q 49
	
	0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,
	0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,//R 50
	
	0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,
	0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,//S 51
	
	0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,
	0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//T 52
	
	0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,
	0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//U 53
	
	0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,
	0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,//V 54
	
	0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,
	0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00,//W 55
	
	0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,
	0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,//X 56
	
	0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,
	0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//Y 57
	
	0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,
	0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,//Z 58
	
	0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,
	0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,//[ 59
	
	0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,//\ 60
	
	0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,
	0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,//] 61
	
	0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//^ 62
	
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,//_ 63
	
	0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//` 64
	
	0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,
	0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,//a 65
	
	0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,
	0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,//b 66
	
	0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,
	0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,//c 67
	
	0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,
	0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,//d 68
	
	0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,
	0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,//e 69
	
	0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,
	0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//f 70
	
	0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,
	0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,//g 71
	
	0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,
	0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//h 72
	
	0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,
	0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//i 73
	
	0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,
	0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,//j 74
	
	0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,
	0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,//k 75
	
	0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,
	0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//l 76
	
	0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,
	0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,//m 77
	
	0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,
	0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//n 78
	
	0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,
	0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//o 79
	
	0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,
	0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,//p 80
	
	0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,
	0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,//q 81
	
	0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,
	0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,//r 82
	
	0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,
	0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,//s 83
	
	0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,
	0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,//t 84
	
	0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,
	0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,//u 85
	
	0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,
	0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,//v 86
	
	0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,
	0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,//w 87
	
	0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,
	0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,//x 88
	
	0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,
	0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,//y 89
	
	0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,
	0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,//z 90
	
	0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,
	0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,//{ 91
	
	0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,//| 92
	
	0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,
	0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00,//} 93
	
	0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//~ 94
};

/*OLED字模库，�?10像素，高16像素*/
const uint16_t hanzi[][40]={

0x00,0x00,0x30,0x60,0x00,0xFE,0x40,0x40,0x40,0x40,0xFE,0x40,0xC0,0x44,0x48,0x38,
0x00,0x00,0x00,0x08,0x04,0x02,0x01,0x7F,0x80,0x40,0x20,0x1C,0x03,0x00,0x07,0x18,
0x30,0x60,0x40,0x00,/*"�?",0*/
0x00,0x00,0x10,0x10,0x10,0x10,0x90,0xF0,0x1E,0x30,0x50,0x90,0x90,0x10,0x08,0x08,
0x00,0x00,0x00,0x20,0x22,0x1A,0x01,0x7D,0x40,0x40,0x45,0x5B,0x40,0x40,0x60,0x01,
0x09,0x33,0x00,0x00,/*"�?",1*/
0x00,0x00,0x10,0xE0,0xFE,0x90,0x18,0x08,0xE8,0xBE,0xAA,0xA8,0xA8,0xBE,0xE8,0x24,
0x00,0x00,0x00,0x04,0x03,0x00,0x7F,0x80,0x89,0x48,0x4B,0x2A,0x1A,0x0E,0x1A,0x2A,
0x4B,0x48,0x48,0x00,/*"�?",2*/
0x00,0x00,0x10,0x90,0x90,0x10,0x90,0x90,0x90,0x90,0xFE,0x12,0x12,0x14,0x1C,0x10,
0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x1F,0x10,0x10,0x10,0x00,0x01,0x0F,0x18,0x20,
0x60,0x40,0x78,0x00,/*"�?",3*/
0x00,0x44,0x44,0x44,0xFC,0x44,0x44,0x04,0x04,0x84,0x64,0xDC,0x04,0x84,0x04,0x04,
0x04,0x00,0x00,0x10,0x08,0x08,0x07,0x04,0x04,0x04,0x02,0x01,0x00,0x7F,0x00,0x00,
0x01,0x06,0x04,0x00,/*"�?",4*/
0x00,0x20,0x20,0xFE,0x20,0x20,0x20,0x48,0xC8,0xB8,0xCA,0xC6,0xA8,0xD8,0xC8,0x20,
0x00,0x00,0x00,0x08,0x08,0x0F,0x88,0x84,0x44,0x40,0x4F,0x3A,0x0A,0x0A,0x7A,0x4A,
0x4F,0x40,0x60,0x00,/*"�?",5*/
0x00,0x00,0x10,0x10,0xFE,0x90,0x90,0x60,0x98,0xB0,0x80,0x7E,0x80,0xA0,0x98,0xC8,
0x00,0x00,0x00,0x06,0x42,0xC2,0x7F,0x00,0x00,0x20,0x24,0x24,0x24,0x24,0x24,0x24,
0x24,0x7F,0x00,0x00,/*"�?",6*/
0x00,0x00,0xC0,0x20,0xFC,0x06,0x00,0xD0,0x10,0x12,0x1C,0x18,0x10,0xD0,0x50,0x10,
0x00,0x00,0x00,0x01,0x00,0x00,0x7F,0x40,0x40,0x40,0x43,0x4C,0x40,0x20,0x5E,0x41,
0x40,0x20,0x00,0x00,/*"�?",7*/
0x00,0x00,0x08,0x08,0x88,0x78,0x58,0x58,0x5A,0x5C,0x58,0x58,0xF8,0x08,0x08,0x08,
0x08,0x00,0x00,0x84,0x83,0x41,0x41,0x31,0x1D,0x05,0x05,0x05,0x05,0x7D,0x41,0x41,
0x45,0x43,0x60,0x00,/*"�?",8*/
0x00,0x00,0x04,0x04,0xC4,0x04,0x04,0x04,0xF8,0xF8,0x04,0x04,0x84,0x44,0x04,0x04,
0x00,0x00,0x00,0x80,0x40,0x43,0x21,0x20,0x10,0x0C,0x03,0x01,0x06,0x09,0x10,0x30,
0x20,0x60,0x00,0x00,/*"�?",9*/




};


//提示符的字符缓存
char consoleTempA[20];
char consoleTempB[20];
char consoleTempC[20];
char consoleTempD[20];

int lenth=0;//用于Printf 计量字符长度



/*引脚初始�?*/

void OLED_I2C_Init(void)
{

	
	OLED_W_SCL(1);
	OLED_W_SDA(1);
}

/**
  * @brief  I2C开�?
  * @param  �?
  * @retval �?
  */
void OLED_I2C_Start(void)
{
	OLED_W_SDA(1);
	OLED_W_SCL(1);
	OLED_W_SDA(0);
	OLED_W_SCL(0);
}

/**
  * @brief  I2C停止
  * @param  �?
  * @retval �?
  */
void OLED_I2C_Stop(void)
{
	OLED_W_SDA(0);
	OLED_W_SCL(1);
	OLED_W_SDA(1);
}

/**
  * @brief  I2C发送一个字�?
  * @param  Byte 要发送的一个字�?
  * @retval �?
  */
void OLED_I2C_SendByte(uint8_t Byte)
{
	uint8_t i;
	for (i = 0; i < 8; i++)
	{
		OLED_W_SDA(Byte & (0x80 >> i));
		OLED_W_SCL(1);
		OLED_W_SCL(0);
	}
	OLED_W_SCL(1);	//额外的一个时钟，不处理应答信�?
	OLED_W_SCL(0);
}

/**
  * @brief  OLED写命�?
  * @param  Command 要写入的命令
  * @retval �?
  */
void OLED_WriteCommand(uint8_t Command)
{
	OLED_I2C_Start();
	OLED_I2C_SendByte(0x78);		//从机地址
	OLED_I2C_SendByte(0x00);		//写命�?
	OLED_I2C_SendByte(Command); 
	OLED_I2C_Stop();
}

/**
  * @brief  OLED写数�?
  * @param  Data 要写入的数据
  * @retval �?
  */
void OLED_WriteData(uint8_t Data)
{
	OLED_I2C_Start();
	OLED_I2C_SendByte(0x78);		//从机地址
	OLED_I2C_SendByte(0x40);		//写数�?
	OLED_I2C_SendByte(Data);
	OLED_I2C_Stop();
}

/**
  * @brief  OLED设置光标位置
  * @param  Y 以左上角为原点，向下方向的坐标，范围�?0~7
  * @param  X 以左上角为原点，向右方向的坐标，范围�?0~127
  * @retval �?
  */
void OLED_SetCursor(uint8_t Y, uint8_t X)
{
	OLED_WriteCommand(0xB0 | Y);					//设置Y位置
	OLED_WriteCommand(0x10 | ((X & 0xF0) >> 4));	//设置X位置�?4�?
	OLED_WriteCommand(0x00 | (X & 0x0F));			//设置X位置�?4�?
}

/**
  * @brief  OLED清屏
  * @param  �?
  * @retval �?
  */
void OLED_Clear(void)
{  
	uint8_t i, j;
	for (j = 0; j < 8; j++)
	{
		OLED_SetCursor(j, 0);
		for(i = 0; i < 128; i++)
		{
			OLED_WriteData(0x00);
		}
	}
}

/**
  * @brief  OLED显示一个字�?
  * @param  Line 行位置，范围�?1~4
  * @param  Column 列位置，范围�?1~16
  * @param  Char 要显示的一个字符，范围：ASCII可见字符
  * @retval �?
  */
void OLED_ShowChar(uint8_t Line, uint8_t Column, char Char)
{      	
	uint8_t i;
	OLED_SetCursor((Line - 1) * 2, (Column - 1) * 8);		//设置光标位置在上半部�?
	for (i = 0; i < 8; i++)
	{
		OLED_WriteData(OLED_F8x16[Char - ' '][i]);			//显示上半部分内容
	}
	OLED_SetCursor((Line - 1) * 2 + 1, (Column - 1) * 8);	//设置光标位置在下半部�?
	for (i = 0; i < 8; i++)
	{
		OLED_WriteData(OLED_F8x16[Char - ' '][i + 8]);		//显示下半部分内容
	}
}

/**
  * @brief  OLED显示字符�?
  * @param  Line 起始行位置，范围�?1~4
  * @param  Column 起始列位置，范围�?1~16
  * @param  String 要显示的字符串，范围：ASCII可见字符
  * @retval �?
  */
void OLED_ShowString(uint8_t Line, uint8_t Column, char *String)
{
	uint8_t i;
	for (i = 0; String[i] != '\0'; i++)
	{
		OLED_ShowChar(Line, Column + i, String[i]);
	}
}

/**
  * @brief  OLED次方函数
  * @retval 返回值等于X的Y次方
  */
uint32_t OLED_Pow(uint32_t X, uint32_t Y)
{
	uint32_t Result = 1;
	while (Y--)
	{
		Result *= X;
	}
	return Result;
}

/**
  * @brief  OLED显示数字（十进制，正数）
  * @param  Line 起始行位置，范围�?1~4
  * @param  Column 起始列位置，范围�?1~16
  * @param  Number 要显示的数字，范围：0~4294967295
  * @param  Length 要显示数字的长度，范围：1~10
  * @retval �?
  */
void OLED_ShowNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length)
{
	uint8_t i;
	for (i = 0; i < Length; i++)							
	{
		OLED_ShowChar(Line, Column + i, Number / OLED_Pow(10, Length - i - 1) % 10 + '0');
	}
}

/**
  * @brief  OLED显示数字（十进制，带符号数）
  * @param  Line 起始行位置，范围�?1~4
  * @param  Column 起始列位置，范围�?1~16
  * @param  Number 要显示的数字，范围：-2147483648~2147483647
  * @param  Length 要显示数字的长度，范围：1~10
  * @retval �?
  */
void OLED_ShowSignedNum(uint8_t Line, uint8_t Column, int Number, uint8_t Length)
{
	uint8_t i;
	uint32_t Number1;
	if (Number >= 0)
	{
		OLED_ShowChar(Line, Column, '+');
		Number1 = Number;
	}
	else
	{
		OLED_ShowChar(Line, Column, '-');
		Number1 = -Number;
	}
	for (i = 0; i < Length; i++)							
	{
		OLED_ShowChar(Line, Column + i + 1, Number1 / OLED_Pow(10, Length - i - 1) % 10 + '0');
	}
}

/**
  * @brief  OLED显示数字（十六进制，正数�?
  * @param  Line 起始行位置，范围�?1~4
  * @param  Column 起始列位置，范围�?1~16
  * @param  Number 要显示的数字，范围：0~0xFFFFFFFF
  * @param  Length 要显示数字的长度，范围：1~8
  * @retval �?
  */
void OLED_ShowHexNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length)
{
	uint8_t i, SingleNumber;
	for (i = 0; i < Length; i++)							
	{
		SingleNumber = Number / OLED_Pow(16, Length - i - 1) % 16;
		if (SingleNumber < 10)
		{
			OLED_ShowChar(Line, Column + i, SingleNumber + '0');
		}
		else
		{
			OLED_ShowChar(Line, Column + i, SingleNumber - 10 + 'A');
		}
	}
}

/**
  * @brief  OLED显示数字（二进制，正数）
  * @param  Line 起始行位置，范围�?1~4
  * @param  Column 起始列位置，范围�?1~16
  * @param  Number 要显示的数字，范围：0~1111 1111 1111 1111
  * @param  Length 要显示数字的长度，范围：1~16
  * @retval �?
  */
void OLED_ShowBinNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length)
{
	uint8_t i;
	for (i = 0; i < Length; i++)							
	{
		OLED_ShowChar(Line, Column + i, Number / OLED_Pow(2, Length - i - 1) % 2 + '0');
	}
}

/**
  * @brief  OLED初始�?
  * @param  �?
  * @retval �?
  */
void OLED_Init(void)
{
	uint32_t i, j;
	
	for (i = 0; i < 1000; i++)			//上电延时
	{
		for (j = 0; j < 1000; j++);
	}
	
	OLED_I2C_Init();			//端口初始�?
	
	OLED_WriteCommand(0xAE);	//关闭显示
	
	OLED_WriteCommand(0xD5);	//设置显示时钟分频�?/振荡器频�?
	OLED_WriteCommand(0x80);
	
	OLED_WriteCommand(0xA8);	//设置多路复用�?
	OLED_WriteCommand(0x3F);
	
	OLED_WriteCommand(0xD3);	//设置显示偏移
	OLED_WriteCommand(0x00);
	
	OLED_WriteCommand(0x40);	//设置显示开始行
	
	OLED_WriteCommand(0xA1);	//设置左右方向�?0xA1正常 0xA0左右反置
	
	OLED_WriteCommand(0xC8);	//设置上下方向�?0xC8正常 0xC0上下反置

	OLED_WriteCommand(0xDA);	//设置COM引脚硬件配置
	OLED_WriteCommand(0x12);
	
	OLED_WriteCommand(0x81);	//设置对比度控�?
	OLED_WriteCommand(0xCF);

	OLED_WriteCommand(0xD9);	//设置预充电周�?
	OLED_WriteCommand(0xF1);

	OLED_WriteCommand(0xDB);	//设置VCOMH取消选择级别
	OLED_WriteCommand(0x30);

	OLED_WriteCommand(0xA4);	//设置整个显示打开/关闭

	OLED_WriteCommand(0xA6);	//设置正常/倒转显示

	OLED_WriteCommand(0x8D);	//设置充电�?
	OLED_WriteCommand(0x14);

	OLED_WriteCommand(0xAF);	//开启显�?
		
	OLED_Clear();				//OLED清屏
}
void OLED_ShowCHINESE(uint8_t Line, uint8_t Column, uint8_t Num)
{
	
	uint8_t i;
	uint8_t wide = 19;//字宽
	
	OLED_SetCursor(( Line - 1 ) * 2, ( Column - 1 )* wide);		//参数1:把光标设置在第几�?. 参数2:把光标设置在第几�?
	for (i = 0; i < wide; i++)
	{
		OLED_WriteData(hanzi[Num][i]);			//显示上半部分内容
	}
	
	OLED_SetCursor(( Line -1) * 2+1 ,( Column - 1) * wide);		
	for (i = 0; i < wide ; i++)
	{ 
		OLED_WriteData(hanzi[Num][i+wide]);		//显示下半部分内容
	}

}
/**
 * @brief 字符串提示符输出模式 字符总长度不能超�?20
 *  停用提示符模式时,其已经显示的内容不会更新
 * @param chr[]  提示文本�?
 * @param chr2[] 提示文本�? 
 * @param num  提示文本中的变量
 * @param len  数字的长�?
 * @param cmd  控制信号 0_停用提示�? 1_使能终端 2_仅使能常量字�?
 */
void OLED_Console(char chr[],char chr2[],char num,u8 len,u8 cmd)
{
	uint8_t i=0,j=20;
	lenth=0;
	if(!cmd)
		return;
	else
		OLED_Clear();
	while(j--)
	{
		consoleTempA[j]=consoleTempB[j];
		consoleTempB[j]=consoleTempC[j];
		consoleTempC[j]=consoleTempD[j];
		consoleTempD[j]=0;
	}
	consoleTempD[19]='\0';
	j=0;
	for (i = 0; chr[i] != '\0'; i++)
	{
		consoleTempD[j++]=chr[i];
	}
	lenth=i;
	consoleTempD[j++]=' ';
	for (i = 0; i < len && cmd!=2; i++)							
	{consoleTempD[j++]=num / OLED_Pow(10, len - i - 1) % 10 + '0';
	}consoleTempD[j++]=' ';
	for (i = 0; chr2[i] != '\0' && cmd!=2; i++)
	{consoleTempD[j++]=chr2[i];}

	OLED_ShowString(1,1,consoleTempA);
	OLED_ShowString(2,1,consoleTempB);
	OLED_ShowString(3,1,consoleTempC);
	OLED_ShowString(4,1,consoleTempD);
}

int OLED_printf(char *src,char num)
{


	OLED_Console(src,"",num,3,num ? 1 : 2 );

	
	return lenth;
}
// void OLED_ConsoleString(char chr[])
// {

// }



// #if OLED2_MODE==1 
// //向SSD1106写入一个字节�?
// //dat:要写入的数据/命令
// //cmd:数据/命令标志 0,表示命令;1,表示数据;
// void OLED2_WR_Byte(u8 dat,u8 cmd)
// {
// 	DATAOUT(dat);	    
// 	if(cmd)
// 	  OLED2_DC_Set();
// 	else 
// 	  OLED2_DC_Clr();		   
// 	OLED2_CS_Clr();
// 	OLED2_WR_Clr();	 
// 	OLED2_WR_Set();
// 	OLED2_CS_Set();	  
// 	OLED2_DC_Set();	 
// } 	    	    
// #else
// //向SSD1306写入一个字节�?
// //dat:要写入的数据/命令
// //cmd:数据/命令标志 0,表示命令;1,表示数据;
// void OLED2_WR_Byte(u8 dat,u8 cmd)
// {	
// 	u8 i;			  
// 	if(cmd)
// 	  OLED2_DC_Set();
// 	else 
// 	  OLED2_DC_Clr();		  
// 	OLED2_CS_Clr();
// 	for(i=0;i<8;i++)
// 	{			  
// 		OLED2_SCLK_Clr();
// 		if(dat&0x80)
// 			{
// 		   OLED2_SDIN_Set();
// 			}
// else
// 		   OLED2_SDIN_Clr();
// 				OLED2_SCLK_Set();
// 		dat<<=1;   
// 	}				 		  
// 	OLED2_CS_Set();
// 	OLED2_DC_Set();   	  
// } 




// void OLED2_Set_Pos(unsigned char x, unsigned char y) 
// { 
// 	OLED2_WR_Byte(0xb0+y,OLED2_CMD);
// 	OLED2_WR_Byte(((x&0xf0)>>4)|0x10,OLED2_CMD);
// 	OLED2_WR_Byte((x&0x0f)|0x01,OLED2_CMD); 
// }   	  
// //开启OLED2显示    
// void OLED2_Display_On(void)
// {
// 	OLED2_WR_Byte(0X8D,OLED2_CMD);  //SET DCDC命令
// 	OLED2_WR_Byte(0X14,OLED2_CMD);  //DCDC ON
// 	OLED2_WR_Byte(0XAF,OLED2_CMD);  //DISPLAY ON
// }
// //关闭OLED2显示     
// void OLED2_Display_Off(void)
// {
// 	OLED2_WR_Byte(0X8D,OLED2_CMD);  //SET DCDC命令
// 	OLED2_WR_Byte(0X10,OLED2_CMD);  //DCDC OFF
// 	OLED2_WR_Byte(0XAE,OLED2_CMD);  //DISPLAY OFF
// }		   			 
// //清屏函数,清完�?,整个屏幕是黑色的!和没点亮一�?!!!	  
// void OLED2_Clear(void)  
// {  
// 	u8 i,n;		    
// 	for(i=0;i<8;i++)  
// 	{  
// 		OLED2_WR_Byte (0xb0+i,OLED2_CMD);    //设置页地址�?0~7�?
// 		OLED2_WR_Byte (0x00,OLED2_CMD);      //设置显示位置—列低地址
// 		OLED2_WR_Byte (0x10,OLED2_CMD);      //设置显示位置—列高地址   
// 		for(n=0;n<128;n++)OLED2_WR_Byte(0,OLED2_DATA); 
// 	} //更新显示
// }


// //在指定位置显示一个字�?,包括部分字符
// //x:0~127
// //y:0~63
// //mode:0,反白显示;1,正常显示				 
// //size:选择字体 16/12 
// void OLED2_ShowChar(u8 x,u8 y,u8 chr)
// {      	
// 	unsigned char c=0,i=0;	
// 		c=chr-' ';//得到偏移后的�?			
// 		if(x>Max_Column-1){x=0;y=y+2;}
// 		if(SIZE ==16)
// 			{
// 			OLED2_Set_Pos(x,y);	
// 			for(i=0;i<8;i++)
// 			OLED2_WR_Byte(OLED_F8x16[c][i],OLED2_DATA);
// 			OLED2_Set_Pos(x,y+1);
// 			for(i=0;i<8;i++)
// 			OLED2_WR_Byte(OLED_F8x16[c][i+8],OLED2_DATA);
// 			}
// 			else {	
// 				OLED2_Set_Pos(x,y+1);
// 				for(i=0;i<6;i++)
// 				OLED2_WR_Byte(OLED_F8x16[c][i],OLED2_DATA);
				
// 			}
// }
// //m^n函数
// u32 OLED2_pow(u8 m,u8 n)
// {
// 	u32 result=1;	 
// 	while(n--)result*=m;    
// 	return result;
// }				  
// //显示2个数�?
// //x,y :起点坐标	 
// //len :数字的位�?
// //size:字体大小
// //mode:模式	0,填充模式;1,叠加模式
// //num:数�?(0~4294967295);	 		  
// void OLED2_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size2)
// {         	
// 	u8 t,temp;
// 	u8 enshow=0;						   
// 	for(t=0;t<len;t++)
// 	{
// 		temp=(num/OLED2_pow(10,len-t-1))%10;
// 		if(enshow==0&&t<(len-1))
// 		{
// 			if(temp==0)
// 			{
// 				OLED2_ShowChar(x+(size2/2)*t,y,' ');
// 				continue;
// 			}else enshow=1; 
		 	 
// 		}
// 	 	OLED2_ShowChar(x+(size2/2)*t,y,temp+'0'); 
// 	}
// } 

// //显示一个字符号�?
// char debuger[]="asasdasd";
// void OLED2_ShowString(u8 x,u8 y,char chr[])
// {
// 	unsigned char j=0,i=10;
// 	while(chr[j]!='\0')
// 	{		
// 			OLED2_ShowChar(x,y,chr[j]);
// 			x+=8;
// 			if(x>120){x=0;y+=2;}
// 			j++;
// 	}
// }
// //显示汉字
// void OLED2_ShowCHinese(u8 x,u8 y,u8 no)
// {      			    
// 	u8 t,adder=0;
// 	OLED2_Set_Pos(x,y);	
//     for(t=0;t<16;t++)
// 		{
// 				OLED2_WR_Byte(hanzi[2*no][t],OLED2_DATA);
// 				adder+=1;
//      }	
// 		OLED2_Set_Pos(x,y+1);	
//     for(t=0;t<16;t++)
// 			{	
// 				OLED2_WR_Byte(hanzi[2*no+1][t],OLED2_DATA);
// 				adder+=1;
//       }					
// }

// /***********功能描述：显示显示BMP图片128×64起始点坐�?(x,y),x的范�?0�?127，y为页的范�?0�?7*****************/
// void OLED2_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[])
// { 	
//  unsigned int j=0;
//  unsigned char x,y;
  
//   if(y1%8==0) y=y1/8;      
//   else y=y1/8+1;
// 	for(y=y0;y<y1;y++)
// 	{
// 		OLED2_Set_Pos(x0,y);
//     for(x=x0;x<x1;x++)
// 	    {      
// 	    	OLED2_WR_Byte(BMP[j++],OLED2_DATA);	    	
// 	    }
// 	}
// } 


// //初始化SSD1306					    
// void OLED2_Init(void)
// {
 

 
//   OLED2_RST_Set();
// 	HAL_Delay(100);
// 	OLED2_RST_Clr();
// 	HAL_Delay(100);
// 	OLED2_RST_Set(); 

// 	OLED2_WR_Byte(0xAE,OLED2_CMD);//--turn off OLED2 panel
// 	OLED2_WR_Byte(0x00,OLED2_CMD);//---set low column address
// 	OLED2_WR_Byte(0x10,OLED2_CMD);//---set high column address
// 	OLED2_WR_Byte(0x40,OLED2_CMD);//--set start line address  Set Mapping RAM Display Start Line (0x00~0x3F)
// 	OLED2_WR_Byte(0x81,OLED2_CMD);//--set contrast control register
// 	OLED2_WR_Byte(0xCF,OLED2_CMD); // Set SEG Output Current Brightness
// 	OLED2_WR_Byte(0xA1,OLED2_CMD);//--Set SEG/Column Mapping     0xa0左右反置 0xa1正常
// 	OLED2_WR_Byte(0xC8,OLED2_CMD);//Set COM/Row Scan Direction   0xc0上下反置 0xc8正常
// 	OLED2_WR_Byte(0xA6,OLED2_CMD);//--set normal display
// 	OLED2_WR_Byte(0xA8,OLED2_CMD);//--set multiplex ratio(1 to 64)
// 	OLED2_WR_Byte(0x3f,OLED2_CMD);//--1/64 duty
// 	OLED2_WR_Byte(0xD3,OLED2_CMD);//-set display offset	Shift Mapping RAM Counter (0x00~0x3F)
// 	OLED2_WR_Byte(0x00,OLED2_CMD);//-not offset
// 	OLED2_WR_Byte(0xd5,OLED2_CMD);//--set display clock divide ratio/oscillator frequency
// 	OLED2_WR_Byte(0x80,OLED2_CMD);//--set divide ratio, Set Clock as 100 Frames/Sec
// 	OLED2_WR_Byte(0xD9,OLED2_CMD);//--set pre-charge period
// 	OLED2_WR_Byte(0xF1,OLED2_CMD);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
// 	OLED2_WR_Byte(0xDA,OLED2_CMD);//--set com pins hardware configuration
// 	OLED2_WR_Byte(0x12,OLED2_CMD);
// 	OLED2_WR_Byte(0xDB,OLED2_CMD);//--set vcomh
// 	OLED2_WR_Byte(0x40,OLED2_CMD);//Set VCOM Deselect Level
// 	OLED2_WR_Byte(0x20,OLED2_CMD);//-Set Page Addressing Mode (0x00/0x01/0x02)
// 	OLED2_WR_Byte(0x02,OLED2_CMD);//
// 	OLED2_WR_Byte(0x8D,OLED2_CMD);//--set Charge Pump enable/disable
// 	OLED2_WR_Byte(0x14,OLED2_CMD);//--set(0x10) disable
// 	OLED2_WR_Byte(0xA4,OLED2_CMD);// Disable Entire Display On (0xa4/0xa5)
// 	OLED2_WR_Byte(0xA6,OLED2_CMD);// Disable Inverse Display On (0xa6/a7) 
// 	OLED2_WR_Byte(0xAF,OLED2_CMD);//--turn on OLED2 panel
	
// 	OLED2_WR_Byte(0xAF,OLED2_CMD); /*display ON*/ 
// 	OLED2_Clear();
// 	OLED2_Set_Pos(0,0); 	
// }  
// /**
//  * @brief 用于显示进度�?,从行首至x=100,不可跨行
//  * 
//  * @param y (坐标)显示的行�?
//  * @param process 
//  */
// void OLED2_ProcessBar2(u8 y,u8 process)
// {
// 	u8 asd=100-process;
// 	OLED2_ShowNum(100,y-1,process,3,18);
// 	OLED2_Set_Pos(1,y);
// 	if(process>100)
// 		return;
// 	while(process--)
// 		OLED2_WR_Byte(0xFF,OLED2_DATA);
// 	while(asd--)
// 		OLED2_WR_Byte(0,OLED2_DATA);
	
		


// }
// void OLED2_ShowwhiteChar(u8 x,u8 y,u8 chr)
// {      	
// 	unsigned char c=0,i=0;	
// 		c=chr-' ';//得到偏移后的�?			
// 		if(x>Max_Column-1){x=0;y=y+2;}
// 		if(SIZE ==16)
// 			{
// 			OLED2_Set_Pos(x,y);	
// 			for(i=0;i<8;i++)
// 			OLED2_WR_Byte(~OLED_F8x16[c][i],OLED2_DATA);
// 			OLED2_Set_Pos(x,y+1);
// 			for(i=0;i<8;i++)
// 			OLED2_WR_Byte(~OLED_F8x16[c][i+8],OLED2_DATA);
// 			}
// 			else {	
// 				OLED2_Set_Pos(x,y+1);
// 				for(i=0;i<6;i++)
// 				OLED2_WR_Byte(~OLED_F8x16[c][i],OLED2_DATA);
				
// 			}
// }
// /// @brief 显示反色数字
// /// @param x X
// /// @param y Y
// /// @param num 
// /// @param len 数字长度
// /// @param size2 像素长度
// void OLED2_WhiteNum(u8 x,u8 y,u32 num,u8 len,u8 size2)
// {
// 	u8 t,temp;
// 	u8 enshow=0;						   
// 	for(t=0;t<len;t++)
// 	{
// 		temp=(num/OLED2_pow(10,len-t-1))%10;
// 		if(enshow==0&&t<(len-1))
// 		{
// 			if(temp==0)
// 			{
// 				OLED2_ShowwhiteChar(x+(size2/2)*t,y,' ');
// 				continue;
// 			}else enshow=1; 
		 	 
// 		}
// 	 	OLED2_ShowwhiteChar(x+(size2/2)*t,y,temp+'0'); 
// 	}
// }
